<?xml version="1.0" encoding="ISO-8859-1" ?>

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:rich="http://richfaces.org/rich"
	  xmlns:a4j="http://richfaces.org/a4j">
	
	<f:subview id="subviewManterModelo">

		<rich:modalPanel id="manterModelo" autosized="true" headerClass="height:20px;" resizeable="false" >
			<f:facet name="header">
				<h:outputText value="#{bundle.modelo_titulo_manter}" />
			</f:facet>

			<rich:messages id="msgModeloConsultar" styleClass="mensagem_erro"></rich:messages>
			<a4j:form ajaxSubmit="true" id="formModeloManter" reRender="formModeloManter">
			
				<script type="text/javascript">		
					function valida() {
						if (#{facesContext.maximumSeverity == null}) {
							#{rich:component('manterModelo')}.hide();
						}
					}
				</script>
				
				<h:panelGrid columns="2">
					<h:outputLabel value="Tipo Modelo:"/>
					<h:selectOneRadio onchange="submitSubview('formModeloManter');" id="modelo_tipo_modelo" value="#{modeloBackBean.modeloFormBean.modeloManter.tipoModelo}" disabled="#{modeloBackBean.modeloFormBean.modeloManter.codigo != 0}">
						<f:selectItem itemValue="1" itemLabel="#{bundle.modelo_tipo_modelo_onibus}" />
						<f:selectItem itemValue="2" itemLabel="#{bundle.modelo_tipo_modelo_van}" />
						<f:selectItem itemValue="3" itemLabel="#{bundle.modelo_tipo_modelo_passeio}" />
					</h:selectOneRadio>
				</h:panelGrid>
			
                <h:panelGrid columns="3">
                
                	<h:outputLabel value="#{bundle.modelo_codigo}:" for="modelo_codigo" />
                    <h:inputText id="modelo_codigo" value="#{modeloBackBean.modeloFormBean.modeloManter.codigo}" label="#{bundle.modelo_codigo}" readonly="true" disabled="#{modeloBackBean.modeloFormBean.isDisabled}" size="5" />
                    <h:panelGroup></h:panelGroup>
                    
                	<h:outputLabel value="#{bundle.modelo_descricao}*:" for="modelo_descricao" />
                    <h:inputText id="modelo_descricao" value="#{modeloBackBean.modeloFormBean.modeloManter.descricao}" label="#{bundle.modelo_descricao}" disabled="#{modeloBackBean.modeloFormBean.isDisabled}" maxlength="50" size="40" />
                    <h:panelGroup></h:panelGroup>
                    
                    <h:outputLabel value="#{bundle.modelo_marca}*:" for="modelo_marca_descricao" />
                	<h:panelGroup>
	                	<h:inputHidden id="modelo_marca_codigo" value="#{modeloBackBean.modeloFormBean.modeloManter.marcaVO.codigo}" label="#{bundle.modelo_marca_codigo}" />
	                	<h:inputText id="modelo_marca_descricao" value="#{modeloBackBean.modeloFormBean.modeloManter.marcaVO.descricao}" label="#{bundle.modelo_marca_descricao}" disabled="#{modeloBackBean.modeloFormBean.isDisabled}" size="40" maxlength="50" />
                	</h:panelGroup>
                	
                    <a4j:commandButton actionListener="#{marcaBackBean.listenerIrConsultarMarcaVeiculo}" value="#{bundle.modelo_btn_popup}" id="btnPopupMarca" reRender="formMarcaConsulta" disabled="#{modeloBackBean.modeloFormBean.isDisabled}" onclick="caso_de_uso_marca = 'modelo';">
                    	<rich:componentControl for="popupMarca" attachTo="btnPopupMarca" operation="show" event="onclick" />
                    </a4j:commandButton>
                	
                	<rich:jQuery selector="#modelo_marca_descricao" timing="onload" query="attr('readOnly', true)" />
                	
                </h:panelGrid>

                <div class="linha"/>
                
                <a4j:commandButton action="#{modeloBackBean.manterModelo}" value="#{bundle.modelo_btn_gravar}" id="btnGravar" reRender="formModeloConsulta, formModeloManter" disabled="#{modeloBackBean.modeloFormBean.isDisabled}" oncomplete="valida();" />
                <a4j:commandButton action="#{modeloBackBean.excluirModelo}" value="#{bundle.modelo_btn_excluir}" id="btnExcluir" reRender="formModeloConsulta, formModeloManter" disabled="#{!modeloBackBean.modeloFormBean.isDisabled}" oncomplete="valida();" />
                <a4j:commandButton value="#{bundle.modelo_btn_voltar}" id="btnVoltar" reRender="formModeloConsulta, formModeloManter" oncomplete="valida();" />
					
			</a4j:form>

		</rich:modalPanel>
	
		<ui:include src="/pages/marca/popupMarca.xhtml" />
		
	</f:subview>

</html>